home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / library / hack99 / qmail-DoS-anonymous.txt < prev    next >
Encoding:
Internet Message Format  |  1999-03-24  |  5.4 KB

  1. Date: Tue, 5 Jan 1999 22:41:44 -0000
  2. From: D. J. Bernstein <djb@CR.YP.TO>
  3. To: BUGTRAQ@netspace.org
  4. Subject: Re: Anonymous Qmail Denial of Service
  5.  
  6. News flash: There are dozens of denial-of-service attacks on every MTA.
  7.  
  8. Example: Any Internet user can create a continuing torrent of mail from
  9. random Internet addresses to wietse@porcupine.org. A few basic methods:
  10.  
  11.    * Send lots of messages to mailinglistmanager@whatever with a return
  12.      path and From line of wietse@porcupine.org. Automated responses
  13.      will go back to wietse@porcupine.org.
  14.  
  15.    * Send lots of messages to legitimateuser@whatever with a return
  16.      path of wietse@porcupine.org. After the legitimateuser mailbox
  17.      fills up, messages will bounce to wietse@porcupine.org, in some
  18.      cases with a delay.
  19.  
  20.    * Relay lots of messages through MTAs with spam-friendly defaults.
  21.      For example, postfix allows relaying from the local network. If a
  22.      postfix system is dialing into an ISP as (say) 18.25.0.221, and
  23.      you're dialing in as (say) 18.25.0.37, then you can queue messages
  24.      on that system for wietse@porcupine.org.
  25.  
  26.    * Subscribe wietse@porcupine.org to an automated mailing list. The
  27.      majordomo 1.* cookie mechanism doesn't stop this attack; it isn't
  28.      cryptographically secure. (Several students in my cryptography
  29.      class two years ago were able to break it, under time pressure, as
  30.      an extra-credit problem on the midterm.)
  31.  
  32. Thousands of these attacks, producing millions of messages, can be
  33. carried out in a matter of minutes. The porcupine.org (postfix) SMTP
  34. server and mail queue will be flooded, making it practically impossible
  35. for legitimate mail to get through. You can easily remain anonymous, for
  36. example by abusing the student Internet terminals at MIT.
  37.  
  38. As another example, here's a denial-of-service attack on postfix:
  39.  
  40.    Connect to the SMTP server at 127.0.0.1 and inject a mail message.
  41.    Repeat ad nauseam.
  42.  
  43. Most MTAs are able to log the user responsible (by contacting port 113
  44. and dropping unidentified connections); postfix doesn't even try.
  45.  
  46.  
  47. Okay, okay, I admit that this isn't news. Here's what I said in the
  48. qmail documentation, starting with the first release three years ago:
  49.  
  50.    There are lots of interesting remote denial-of-service attacks on any
  51.    mail system. A long-term solution is to insist on prepayment for
  52.    unauthorized resource use. The tricky technical problem is to make
  53.    the prepayment enforcement mechanism cheaper than the expected cost
  54.    of the attacks.
  55.  
  56. Denial-of-service attacks have always been excluded from the qmail
  57. security guarantee (http://pobox.com/~djb/qmail/guarantee.html). They
  58. are present in every MTA, widely documented, and very difficult to fix.
  59.  
  60.  
  61. On the bright side, mailers are _not_ permitted to discard messages for
  62. frivolous reasons such as full disks. They have to report the problem to
  63. the sender, so that the sender can keep the message and try again later.
  64.  
  65. This isn't just common sense. It's also in RFC 1123, Host Requirements,
  66. section 5.3.3, Reliable Mail Receipt:
  67.  
  68.    When the receiver-SMTP accepts a piece of mail (by sending a "250 OK"
  69.    message in response to DATA), it is accepting responsibility for
  70.    delivering or relaying the message.  It must take this responsibility
  71.    seriously, i.e., it MUST NOT lose the message for frivolous reasons,
  72.    e.g., because the host later crashes or because of a predictable
  73.    resource shortage.
  74.  
  75. I'm keeping a list of mail clients that do not handle failures properly;
  76. see http://pobox.com/~djb/docs/maildisasters/queueloss.html. Please let
  77. me know if you have any additions to the list.
  78.  
  79.  
  80. This thread began when Venema claimed that it was impossible to track a
  81. user who fills up qmail's queue by repeatedly running and killing
  82. qmail-queue.
  83.  
  84. Venema's claim is false. Every inode created this way requires a new
  85. qmail-queue process. The process is visible in the standard UNIX process
  86. list while it is running, and with an X entry in the standard UNIX acct
  87. mechanism after it has been killed; either way, the user is identified.
  88. X entries are sometimes created by legitimate users, but not in the
  89. volume that would be required to fill up the mail queue. Occasional Xs
  90. are not sufficient to carry out this attack, since each inode is
  91. automatically removed by qmail-clean after an appropriate delay.
  92.  
  93. Venema further claims that ``a set-uid posting program cannot guarantee
  94. user identification.'' That claim is false. The user id is provided by
  95. the standard UNIX getuid() system call.
  96.  
  97. See http://pobox.com/~djb/qmail/venema.html for comments on Venema's
  98. previous denial-of-service accusations.
  99.  
  100.  
  101. For the record, nothing here should be interpreted as advocating the
  102. setuid/setgid concept. As I wrote in the qmail documentation in 1995:
  103.  
  104.    A setuid program must operate in a very dangerous environment: a user
  105.    is under complete control of its fds, args, environ, cwd, tty, rlimits,
  106.    timers, signals, and more. Even worse, the list of controlled items
  107.    varies from one vendor's UNIX to the next, so it is very difficult to
  108.    write portable code that cleans up everything.
  109.  
  110.    Of the six most recent sendmail security holes, three worked only
  111.    because the entire sendmail system is setuid.
  112.  
  113. But my conclusion was merely to be very, very careful: ``Do as little as
  114. possible in setuid programs.'' The alternatives, such as world-writable
  115. directories, are horrendous. We'll be stuck with setuid and setgid until
  116. UNIX develops a simple, portable, reliable, secure IPC mechanism.
  117.  
  118. ---Dan
  119.  
  120.